$('#btn').on("click",function () {
    var keyword=$('#key').val();
    $.ajax({
        url:'/location_analysis/',
        type:"post",
        data:{"keyword":keyword},
        success:function (arg) {
            var x_list=arg.x_list;
            var y_list=arg.y_list;
            var dict_data=arg.dict_data;
            var myCharts=echarts.init(document.getElementById("main"));
            var myChartsa=echarts.init(document.getElementById("maina"));
            var  option = {

                    title: [{text: '工作地点数据分析--地点分布图', subtext: '数据来自网络',},
                            ],
                    tooltip: [{trigger: 'item', formatter: '{b}<br/>{c}'},

                              ],
                    toolbox: [{show: true,itemSize:20,orient: 'vertical',left: 'rignt', top: '30%',itemGap:15,
                        feature: {dataView: {readOnly: false},restore: {},saveAsImage: {}}},
                    ],
                    calculable: true,
                    grid: [{
                            top: '20%',
                            left: '50%',
                            right: '40%',
                            containLabel: true
                        },

                    ],
                    visualMap: {
                        min:0,
                        max: 500,
                        text: ['High', 'Low'],
                        realtime: true,
                        calculable: true,
                        inRange: { color: ['lightskyblue', 'yellow', 'orangered']
                        }
                    },
                    series: [
                        {
                            name: '岗位需求量',
                            type: 'map',
                            mapType: 'china', // 自定义扩展图表类型
                            itemStyle: {//地图区域的多边形 图形样式
                                normal: {//是图形在默认状态下的样式
                                    label: {
                                        show: true,//是否显示标签
                                        position: 'center',
                                    }
                                }
                            },
                            data: Object.keys(dict_data).map(function (key) {return {name: key,value: dict_data[key]} })
                        },
                    ]
                    };
            var  optiona = {

                    title: [{text: '工作地点数据分析图', subtext: '数据来自网络',}],
                    tooltip: {trigger: 'axis',axisPointer: {type: 'shadow',label: {show: true}},},
                    toolbox: {show: true,feature: {mark: {show: true},dataView: {show: true, readOnly: false},
                                magicType: {show: true, type: ['line', 'bar']},
                                restore: {show: true},
                                saveAsImage: {show: true}
                        },
                    },
                    calculable: true,
                    grid: [{
                            top: '20%',
                            left: '5%',
                            right: '40%',
                        containLabel: true
                        },

                    ],xAxis: [
                        {
                            type: 'category',
                            axisLabel: {
                                formatter: function (a) {
                                    a = +a;
                                    return isFinite(a)
                                        ? echarts.format.addCommas(+a )
                                        : '';
                                }
                            },
                            data:x_list
                        }

                    ],
                    yAxis: [
                        {
                            type: 'value',
                            data:y_list,
                        }
                    ],
                    dataZoom: [
                        {
                            show: true,
                            start: 94,
                            end: 100
                        },
                        {
                            type: 'inside',
                            start: 94,
                            end: 100,
                        },
                        {
                            show: true,
                            yAxisIndex: 0,
                            filterMode: 'empty',
                            width: 20,
                            height: '75%',
                            showDataShadow: false,
                            left: '1%'
                        }
                    ],
                    series: [
                        {
                            name:"岗位需求量",
                            type: 'bar',
                            data: y_list,
                            center: ['70%', '30%'],
                        },
                        {
                        type: 'pie',
                        radius: '45%',
                        center: ['82%', '50%'],
                        data: Object.keys(dict_data).map(function (key) {return {
                                                                                        name: key,
                                                                                        value: dict_data[key]}
                                                                                })
                    }
                    ]
                    };

            myCharts.setOption(option);
            myChartsa.setOption(optiona)
        }
    })
});